home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
RPRIMES.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-16
|
508b
|
37 lines
/* rprimes.c */
#include "stdio.h"
int prime(int, int);
main()
{
int i;
int x, y;
printf("Input Number: ");
scanf("%d",&x); printf("\n%d=",x);
if(x==1){
printf("1*%d\n",x);
}
else if(x){
i=prime(x,2);
if( i==x )
printf("1*%d\n",x);
else
printf("%d*1\n",i);
}
else
printf("YOU entered zero\n");
}
int prime(int y, int i)
{
if(i>=y)
return(i);
else if( !(y%i) ){
printf("%d*",i);
return(prime(y/i,i));
}
else
return(prime(y,i+1));
}